/*class Animals {
    public String name;
    public int age;
    public Animals(String name, int age ) {
        this.name = name;
        this.age = age;
    }
    public void eat() {
        System.out.println(name + "吃饭");
    }
    /*public void sleep() {
        System.out.println(name + "睡觉");
    }
    public void play() {
        System.out.println(name + "做游戏");
    }
}*/
/*
class Cat extends Animals{
    public Cat(String name, int age) {
        super(name, age);
    }
   // public Boolean loveclean;
    //public void catchMouse() {
        //System.out.println("抓老鼠");
    //}
    @Override
    public void eat() {
        System.out.println(name + "吃饭");
    }

}

class Dog extends Animals{
    public Dog(String name, int age) {
        super(name, age);
    }
   // public Boolean siily;//傻
    //public void getFirsbee() {
        //System.out.println(name + "接飞盘");
    //}
    @Override
    public void eat() {
        System.out.println(name + "吃饭");//与父类的eat方法构成重写
    }
}
public class Test {
    public static void eat(Animals animals) {
        animals.eat();
    }
    public static void main(String[] args) {
        Dog dog = new Dog("大黄", 6);
        Cat cat = new Cat("小黑", 6);
        eat(dog);
        eat(cat);
    }
}*/

class Animals {
    public String name;
    public int age;
    public Animals(String name, int age ) {
        this.name = name;
        this.age = age;
    }
    public void eat() {
        System.out.println(name + "吃饭");
    }
    /*public void sleep() {
        System.out.println(name + "睡觉");
    }
    public void play() {
        System.out.println(name + "做游戏");
    }*/
}

class Cat1 extends Animals{
    public Cat1(String name, int age) {
        super(name, age);
    }
    // public Boolean loveclean;
    //public void catchMouse() {
    //System.out.println("抓老鼠");
    //}
    @Override
    public void eat() {
        System.out.println(name + "吃饭");
    }

}

class Dog1 extends Animals{
    public Dog1(String name, int age) {
        super(name, age);
    }
    // public Boolean siily;//傻
    //public void getFirsbee() {
    //System.out.println(name + "接飞盘");
    //}
    @Override
    public void eat() {
        System.out.println(name + "吃饭");//与父类的eat方法构成重写
    }
}
public class Test {
    public static void eat(Animals animals) {
        animals.eat();
    }
    public static void main(String[] args) {
        //直接赋值
       Animals cat = new Cat("小黑", 7);
       Dog dog = new Dog("大黄", 6);
       eat(cat);
       eat(dog);


    }
}
